'use strict'

define(['jquery', 'bootstrap', 'datetimepicker', 'datetimepickerCN', 'shiftform', 'validate', 'validate.en'], function($) {
  
  return {
        
    init: function() {
        this.agentPay();
        this.agentExport()
    },
    
      agentPay: function() {
          $(document).on('shown.bs.modal', '#agent-record-pay', function(e){
          	
        	  $(e.currentTarget).find("form").shiftform() 
              
          })
      },
      
      exportSchedule: function() {
        	var that = this
            $(document).on('shown.bs.modal', '#export-schedule', function(e){
            	
    	    	$(e.currentTarget).find('form[data-validate="true"]').bt_validate()  //bind validate
    	    	
    	    	$('button[type="submit"').click(function() {
    	    		$(e.currentTarget).find("form").trigger("validate.ajax.submit");
    	            $.bt_validate.result[$.bt_validate.form_id]
    	    	})
    	    	
    	        
            })
          },
          agentExport: function() {
            	var that = this
                $(document).on('shown.bs.modal', '#agent-export', function(e){
                	
        	    	$(e.currentTarget).find('form[data-validate="true"]').bt_validate()  //bind validate
        	    	
        	    	$('button[type="submit"').click(function() {
        	    		$(e.currentTarget).find("form").trigger("validate.ajax.submit");
        	            $.bt_validate.result[$.bt_validate.form_id]
        	    	})
        	    	
        	        
                })
              },
    
  }
})
